from django.db import models
from user.models import UserInfo
from branch.models import ZSDYList
# Create your models here.


class ReportInfo(models.Model):
    """
    报告表
    """
    REPORTCATEGORY = (
        (u'入党申请书', u'入党申请书'),
        (u'思想汇报', u'思想汇报'),
        (u'初党总结', u'初党总结'),
        (u'高党总结', u'高党总结'),
        (u'个人自传', u'个人自传'),
        (u'入党志愿书', u'入党志愿书'),
        (u'转正申请书', u'转正申请书'),
    )
    author = models.ForeignKey(
        UserInfo,
        verbose_name=u'报告作者',
        on_delete=models.CASCADE
    )
    devPeo = models.ForeignKey(
        ZSDYList,
        verbose_name=u'批改报告的培养人',
        on_delete=models.DO_NOTHING,  # 报告的删除不由培养人决定
    )
    reportType = models.CharField(
        choices=REPORTCATEGORY,
        max_length=20,
        verbose_name=u'报告种类',
    )
    createTime = models.DateTimeField(
        auto_now_add=True,
        verbose_name=u"创建时间",
    )
    reportTime = models.CharField(
        verbose_name=u"报告撰写时间",
        max_length=50,
        default='',
    )
    isDone = models.BooleanField(
        verbose_name=u"是否可以抄写",
        default=False,
    )
    isSubmit = models.BooleanField(
        verbose_name=u"是否提交过",
        default=False,
    )
    isCorrect = models.BooleanField(
        verbose_name=u"是否批改过",
        default=False,
    )
    html = models.TextField(
        verbose_name=u"汇报人编辑的报告",
        default=u"",
    )
    comment = models.CharField(
        max_length=5000,
        verbose_name=u'培养人评价',
        default=u"",
    )
    correctHtml = models.TextField(
        verbose_name=u"培养人修改报告",
        default=u"",
    )
    reportAuthor = models.CharField(
        verbose_name=u'报告的作者名字，用于在管理平台显示姓名',
        default=u"",
        max_length=50,
    )

    def __str__(self):
        return self.reportAuthor

    class Meta:
        ordering = ('createTime',)
        verbose_name = '文字材料'  # 单数形式
        verbose_name_plural = '文字材料'  # 复数形式
